<template>
  <div></div>
</template>

<script>
export default {
  components: {
    Calendar,
  },
  data() {
    return {
      xAxisList: [
        {
          name: "2021-01-19",
          data: [
            {
              name: "LAM1",
              value: "2.8",
            },
          ],
        },
        {
          name: "2021-01-20",
          data: [
            {
              name: "LAM2",
              value: "1",
            },
          ],
        },
        {
          name: "2021-01-28",
          data: [
            {
              name: "LAM1",
              value: "1.1",
            },
            {
              name: "LAM2",
              value: "1",
            },
          ],
        },
      ],
      xAxis: ["LAM1", "LAM2"],
      newxAxisList: [],
    };
  },
  mounted() {
    //處理完的函
    this.newxAxisList = this.handleList();
    console.log(this.newxAxisList, "newxAxisList_____");
  },
  methods: {
    handleList() {
      for (let index = 0; index < this.xAxis.length; index++) {
        var item = this.xAxis[index];
        console.log(item);
        for (let j = 0; j < this.xAxisList.length; j++) {
          let list = this.xAxisList[j];
          let dataList = list.data;

          let isHave = false;
          dataList.forEach((value) => {
            if (value.name == item) {
              isHave = true;
            }
          });
          if (isHave == false) {
            let params = {
              name: item,
              value: 0,
            };
            dataList.push(params);
            this.xAxisList[j].data = dataList;
          }
        }
      }
      return this.xAxisList;
    },
  },
};
</script>

<style lang='scss' scoped>
</style>
